# 注册页面的select下拉练习
import os
import time

from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.select import Select


class Select1:
    def __init__(self):
        self.driver = webdriver.Chrome()
        self.url = "file:///" + os.path.abspath("../代码练习/html") + "/注册B.html"
        self.driver.get(self.url)
        self.s1 = self.driver.find_element(By.ID, 'selectB')
        self.select = Select(self.s1)

    def index1(self):
        time.sleep(3)
        self.select.select_by_index(3)

    def values(self):
        time.sleep(3)
        self.select.select_by_value('gz')

    def text(self):
        time.sleep(3)
        self.select.select_by_visible_text('北京B')

    def quit(self):
        self.driver.quit()

if __name__ == '__main__':
    da = Select1()
    da.index1()
    da.values()
    da.text()
    da.quit()



















